<?php
/*
Template Name: Sitemap
*/
?>
<?php 
 

$hasSidebar = "";
$sidebar =    get_post_meta($post->ID,'_sidebar',true);
$sidebar = (trim($sidebar)=="") ? "full" : $sidebar; // ~~ For pages existing prior to theme activation should have full width by default ~   

if($sidebar!="full") :
	
	$hasSidebar = ($sidebar == "right-sidebar") ?	"hasRightSidebar" : "hasLeftSidebar";
	$layout = 'two-third-width'; 
else :
	$layout = 'full-width';
endif;

    
get_header(); 
	
	?>   



<div class="skeleton clearfix page blog <?php echo $hasSidebar; ?>">
      
      <div class="content clearfix">
         
             
            <div class="<?php if($sidebar!="full") echo "two-third-width"; else echo "full-width"; ?>">
               
               <h1 class="custom-font heading"><?php the_title(); ?></h1>    
               
              <?php 	wp_reset_query(); if(have_posts()): while(have_posts()) : the_post(); ?>
              
              
              
              <div class="single-sitemap-content"> 
            
               <?php endwhile; endif; ?>
                
              <h2 id="authors"><?php _e('Authors','h-framework'); ?></h2>
              <ul>
                <?php  wp_list_authors( array(  'exclude_admin' => false   ) );             ?>
              </ul>
              
              <h2 id="pages">Pages</h2>
              <ul>
              <?php
               wp_list_pages(   array( 'exclude' => '', 'title_li' => '' ) );
              ?>
              </ul>
              
              <h2 id="posts"><?php _e('Posts','h-framework'); ?></h2>
              <ul class="cats">
			  <?php 
			  
			  $category_ids = get_all_category_ids();
	   	 	foreach($category_ids as $cat_id) {
  		$cat_name = get_cat_name($cat_id);
  		echo "<li> <h5 class='custom-font'> $cat_name </h5><ul class='subcats'>";
		 
			  $query = new WP_Query();
			 
			  $query->query('cat='.$cat_id.'');
			  while ($query->have_posts()) : $query->the_post();  
			 echo " <li><a href=\"".get_permalink()."\">". get_the_title()  ."  </a></li>";
		   endwhile; 
            
		echo "</ul></li>";
		
	}
			  
			  ?>
              </ul> 
              	
                </div> <!-- main content  -->                      
            </div>  
            
           
               <?php  
	  wp_reset_query();
	  if($sidebar!="full") 
	  get_sidebar();  
	 ?>   
                 
      </div>
                  
    
</div> 
    
<?php get_footer(); ?>
      